/**
 * MasicObject
 * <p/>
 * User: joakimd
 * Date: 2013-03-11
 * Time: 11:16
 */
package org.dru.masic {
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.utils.getQualifiedClassName;

public class MasicObject extends EventDispatcher {
    private var _name: String;

    public function MasicObject() {
        setName(getQualifiedClassName(this));
    }

    public final function get name(): String {
        return _name;
    }

    protected final function setName(value: String): void {
        if (value == null) {
            throw new Error("null name");
        }
        if (value != _name) {
            _name = value;
            dispatchEvent(new Event(Event.CHANGE));
        }
    }
}
}
